using System;
using System.IO;
using System.Linq;
using DZJIFC.Model;


namespace DZJIFC.Infrastructure.Export;

// Extremely simplified IFC writer for SZ/CD profiles to demonstrate the pipeline end-to-end.
// It does NOT produce a fully standard-compliant IFC file, but keeps the custom properties
// and basic entities as a line-based pseudo-IFC for downstream testing and mapping.
public class FlatIfcExporter : IExporter
{
    public void Export(IFCModel model, string targetPath, string profile)
    {
        //using var sw = new StreamWriter(targetPath);
        //sw.WriteLine("ISO-10303-21;");
        //sw.WriteLine($"/* PROFILE={profile} SCHEMA={model.Schema} SOURCE={Path.GetFileName(model.SourcePath)} */");
        //sw.WriteLine("HEADER; ENDSEC; DATA;");

        //int id = 1;
        //foreach (var e in model.Elements)
        //{
        //    var props = string.Join(", ", e.PropertySets.Select(ps => ps.Name + ":{" + string.Join(";", ps.Properties.Select(p => p.Name+"="+p.Value.Replace('"','\''))) + "}"));
        //    sw.WriteLine($"#{id++}= {e.IfcType}('{e.Guid}','{e.Name}','{e.Level}','{e.System}',/*{props}*/);");
        //}
        //sw.WriteLine("ENDSEC; END-ISO-10303-21;");
    }
}